<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>回复咨询</title>
    <script src="../../res/js/jquery-3.4.1.min.js"></script>
    <script src="../../res/layui/layui.js" charset="utf-8" media="all"></script>
    <link rel="stylesheet" href="../../res/layui/css/layui.css" media="all">
    <script src="../../res/js/login_common.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
    <form class="layui-form" action="" id="from">
        <input id="schemeId" name="schemeId" hidden></input>
        <textarea id="results" name="results" required lay-verify="required" style="margin: 0px; width: 858px; height: 143px;" placeholder="请输回复内容" class="layui-textarea"></textarea>
        <div style="width: 216px; margin: 0;">
            <button type="button" class="layui-btn layui-btn-fluid" lay-submit lay-filter="formDemo">提交</button>
        </div>
    </form>
<script>
    $(function () {
        findById();
    })
    var form=null;
    layui.use(['form','laydate'], function(){
        form = layui.form;

        /*不为空判定*/
        form.verify({
            applyForExp:function(value){
                if(value==""){
                    return '必须要写反馈时间哦';
                };
            }
        });

        form.on('submit(formDemo)', function(data){
            var formData = new FormData(document.getElementById("from"));
            var url="../../ase/updateSchemeExpertbyschemeId"
            $.ajax({
                url:url,
                type:"post",
                data:formData,
                async:false,
                processData:false,
                contentType:false,
                dataType:"json",
                success:function(obj){
                    if(obj.num==1){
                        layer.msg("操作成功",{
                            icon:1,
                            time:1000 //1秒关闭(如果不配置默认三秒)
                        },function(){
                            //关闭当前层
                            //当你在iframe页面关闭自身时
                            var index = parent.layer.getFrameIndex(window.name);//先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                            //刷新父页面
                            parent.location.reload();
                        });
                    }else{
                        alert("操作失败")
                    }
                },
                error:function(e){
                }
            });
            return false;
        })

    })

    function getQueryStringOne(key) {
        var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null)
            return decodeURI(r[2]);
        return null;
    }
    //修改页面的赋值
    function findById(){
        var id=getQueryStringOne("id");
        alert(id)
        $("#schemeId").val(id);
    }
</script>
</body>
</html>